package com.zzyl.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.zzyl.base.PageResponse;
import com.zzyl.dto.AlertRuleDto;
import com.zzyl.entity.AlertData;
import com.zzyl.entity.AlertRule;
import com.zzyl.mapper.AlertDataMapper;
import com.zzyl.mapper.AlertRuleMapper;
import com.zzyl.service.RalertRuleService;
import com.zzyl.vo.AlertRuleVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RalertRuleServiceImpl implements RalertRuleService {
     @Autowired
     private AlertRuleMapper alertRuleMapper;


     @Override
     public void create(AlertRuleDto alertRuleDto) {
//          AlertRule alertRule=new AlertRule();
//          BeanUtil.copyProperties(alertRuleDto,alertRule);
//          alertRuleMapper.create(alertRule);
     }

     @Override
     public PageResponse<AlertRuleVo> getPage(String functionName,
     String alertRuleName, String productKey, Integer pageNum, Integer pageSize) {
          PageHelper.startPage(pageNum, pageSize);
       Page<AlertRuleVo>  page= alertRuleMapper.page(functionName,alertRuleName, productKey);
           PageResponse<AlertRuleVo> of = PageResponse.of(page, AlertRuleVo.class);
            return of;
     }
}
